The projection factor is a key quantity for the interferometric Baade-Wesselink (hereafter IBW) and surface-brightness (hereafter SB) methods of determining the distance of Cepheids. Indeed, it allows a consistent combination of angular and linear diameters of the star. We aim to determine consistent projection factors that include the dynamical structure of the Cepheids' atmosphere. Methods. Hydrodynamical models of delta Cep and l Car have been used to validate a spectroscopic method of determining the projection factor. This method, based on the amplitude of the radial velocity curve, is applied to eight stars observed with the HARPS spectrometer. The projection factor is divided into three sub-concepts : (1) a geometrical effect, (2) the velocity gradient within the atmosphere, and (3) the relative motion of the "optical" pulsating photosphere compared to the corresponding mass elements (hereafter fo-g). Both, (1) and (3) are deduced from geometrical and hydrodynamical models, respectively, while (2) is derived directly from observations. The Fe I 4896.439 A line is found to be the best one to use in the context of IBW and SB methods. A coherent and consistent period-projection factor relation (hereafter Pp relation) is derived for this specific spectral line: p = [0.064 +- 0.020] log P + [1.376 +- 0.023]. This procedure is then extended to derive dynamic projection factors for any spectral line of any Cepheid. This Pp relation is an important tool for removing bias in the calibration of the period-luminosity relation of Cepheids. Moreover, it reveals a new physical quantity fo-g to investigate in the near future.